
<template>
    <div id="print-box" class="print-cloth">
        <div class="fill-wrap  not-print">
            <a href="javascript:void(0)" class="btn cancel-btn" @click="printCancel">返回</a>
            <a href="javascript:void(0)" class="btn print-btn" @click="printContent">打印</a>
        </div>
        <div class="order-lis" id="orderlist-print">
            <h3 class="title">{{cname}}被服申领</h3>
            <div class="print-info">
                <div class="ks"><div>申领科室：{{$root.$data.cloth_print.row.addr}}</div></div>
                <div class="ctime"><div>下单时间：{{$root.$data.cloth_print.row.ctime}}</div></div>
                <div class="otime"><div>预约申领时间：{{$root.$data.cloth_print.row.order_time_txt}}</div></div>
                <div class="des" v-if="$root.$data.cloth_des"><div>订单备注：{{$root.$data.cloth_print.row.des}}</div></div>
            </div>
            <div class="table-wrap">
                <table border="1"  cellspacing="0" cellpadding="0"  style="font-size: 9pt;">
                    <colgroup>
                        <col width="60">
                        <col width="70">
                        <col width="60">
                        <col v-if="$root.$data.cloth_des">
                        <col>
                        <col>
                        <col>
                        <col width="90">
                        <col width="60">
                    </colgroup>
                    <thead>
                    <tr class="thead">
                        <th class="is-center is-leaf"><div class="cell">核定病床</div></th>
                        <th class="is-center is-leaf"><div class="cell">织物类型</div></th>
                        <th class="is-center is-leaf"><div class="cell">尺码</div></th>
                        <th class="is-center is-leaf" v-if="$root.$data.cloth_des"><div class="cell">备注</div></th>
                        <th class="is-center is-leaf"><div class="cell qty-number">下单数量</div></th>
                        <th class="is-center is-leaf"><div class="cell check-number">确认数量</div></th>
                        <th class="is-center is-leaf"><div class="cell send-number">实际送达</div></th>
                        <th class="is-center is-leaf"><div class="cell">合计<br/>(下单/确认/送达)</div></th>
                        <th class="is-center is-leaf"><div class="cell">最高限量</div></th>
                    </tr>
                    </thead>
                    <tbody>

                    <template v-for="(weaving,windex) in $root.$data.cloth_print.row.weaving" :keys="windex">
                        <tr v-for="(size,sindex) in weaving.sizes" :key="weaving.wname+size.wsize">
                            <td class="is-center" v-if="windex == 0 && sindex == 0" :rowspan="$root.$data.cloth_print.row.rowl">
                                <div class="cell">{{$root.$data.cloth_print.row.bed_num}}</div>
                            </td>
                            <td class="is-center"  v-if=" sindex == 0" :rowspan="weaving.sizes.length"><div class="cell">
                                {{weaving.wname}}
                            </div></td>
                            <td class="is-center"><div class="cell">
                                {{size.wsize}}
                            </div></td>

                            <td class="is-center"  v-if="$root.$data.cloth_des" ><div class="cell">
                                {{size.wsize_des}}
                            </div></td>
                            <td class="is-center" ><div class="cell qty-number">
                                <div>{{size.wsize_qty==''?0:size.wsize_qty}}</div>
                            </div></td>

                            <td>
                                <div class="cell check-number">{{size.check ? size.check : 0}}</div>
                            </td>
                            <td>
                                <div class="cell send-number"> {{size.send ? size.send : 0}}</div>
                            </td>

                            <td class="is-center"
                                v-if="sindex == 0" :rowspan="weaving.sizes.length">
                                <div class="cell number">
                                    <span :class="[Number(weaving.wname_total) > Number(weaving.wname_max) ? 'red':'qty-number']">
                                        {{weaving.wname_total?weaving.wname_total:'0'}}
                                    </span> / 
                                    <span class="check-number">{{$root.$data.cloth_print.row.order_status == 1 ? '--' :  weaving.check_total}}</span> / 
                                    <span class="send-number">{{$root.$data.cloth_print.row.order_status == 3 ? weaving.send_total : '--'}}</span>
                                </div>
                            </td>
                            <td class="is-center no-border"  v-if="sindex == 0" :rowspan="weaving.sizes.length"><div class="cell number">
                                {{weaving.wname_max}}
                            </div></td>
                        </tr>
                    </template>

                    <tr>
                        <td class="is-center"><div class="cell">合计</div></td>
                        <td class="is-center"><div class="cell">--</div></td>
                        <td class="is-center"><div class="cell">--</div></td>
                        <td class="is-center" v-if="$root.$data.cloth_des"><div class="cell">--</div></td>
                        <td class="is-center"><div class="cell qty-number">{{$root.$data.cloth_print.row.order_total}}</div></td>
                        <td class="is-center"><div class="cell check-number">{{ $root.$data.cloth_print.row.order_status == 1 ?  '--' : $root.$data.cloth_print.row.check_total}}</div></td>
                        <td class="is-center"><div class="cell send-number">{{ $root.$data.cloth_print.row.order_status == 3 ? $root.$data.cloth_print.row.send_total : '--'}}</div></td>
                        <td class="is-center"><div class="cell">--</div></td>
                        <td class="is-center"><div class="cell">--</div></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <!--<div v-if="isPrint" >-->
            <!--<div class="modal-bg"></div>-->
            <!--<div class="patientModal printModal">-->
                <!--<div class="pHead">是否已经打印？</div>-->
                <!--<div class="pBottom">-->
                    <!--<button class="cancel" @click="isPrint=false">没有</button>-->
                    <!--<button class="sure" @click="surePrint">打印了</button>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->

    </div>
</template>
<script>
    export default{
        props:{
        },
        data(){
            return{
                cname:Cookies.get('categoryname'),
            }

        },
        methods:{
            //打印
            printCancel(){
                this.$root.$data.cloth_print.show = false
            },
            printContent(){
                window.print();
//                if(!this.$root.$data.printHis){
//                    this.isPrint = true;
//                }
            },
            surePrint(){
                this.isPrint = false;
                this.$parent.isprint = false
               /* let id = [],ctime=this.ctime,onlys=new Date(this.ctime.replace(/-/g,'/')).getTime();
                for(var val of this.printLis){
                    id.push(val.id)
                }
                let ektprint = JSON.stringify({"ids":id,"ctime":ctime});
                let localp = {"ids":id,"ctime":ctime,only:onlys}*/
//                this.$emit('isprintfn',ektprint,localp)
            }

        },
        created() {
            document.title = '泰科下单助手';

            setTimeout(function(){
                this.printContent()
            }.bind(this),100)
        }
    }
</script>
<style lang="less">
   @import "../../../assets/less/clothPrint.less";
</style>